{% extends "base.html" %}

{% block content %}
<div class="container mt-3">
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{{ url_for('index') }}">首页</a></li>
            <li class="breadcrumb-item"><a href="#">{{ owner.username }}</a></li>
            <li class="breadcrumb-item"><a href="{{ url_for('repo_detail', username=owner.username, repo_name=repo.name) }}">{{ repo.name }}</a></li>
            <li class="breadcrumb-item active">提交历史</li>
        </ol>
    </nav>

    <div class="d-flex justify-content-between align-items-center mb-3">
        <h2>提交历史</h2>
    </div>

    <div class="card mb-4">
        <div class="card-header">
            <ul class="nav nav-tabs card-header-tabs">
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('repo_detail', username=owner.username, repo_name=repo.name) }}">代码</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="#">提交</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('repo_branches_view', username=owner.username, repo_name=repo.name) }}">分支</a>
                </li>
            </ul>
        </div>
        <div class="card-body">
            <div class="list-group">
                {% for commit in commits %}
                <div class="list-group-item">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <h6 class="mb-1">{{ commit.message }}</h6>
                            <small class="text-muted">
                                {{ commit.author.username }} 提交于 {{ commit.created_at }}
                            </small>
                        </div>
                        <span class="badge bg-secondary rounded-pill">{{ commit.hash[:7] }}</span>
                    </div>
                </div>
                {% endfor %}
            </div>
        </div>
    </div>
</div>
{% endblock %}
